FROM centos:latest

WORKDIR /root
COPY hschain hschain
COPY hschain-cli hschain-cli
COPY genesis_block_config.yaml genesis_block_config.yaml
COPY config config
COPY keystore.json keystore.json
COPY contract-base-1.0.0-SNAPSHOT.jar contract-base-1.0.0-SNAPSHOT.jar

RUN sed -i 's/bootstrapPeers/#bootstrapPeers/g' /root/config/module_configs.yaml
RUN sed -i 's/peerIdPriKeyPath:.*/peerIdPriKeyPath: \/root\/private.key/g' /root/config/module_configs.yaml
RUN sed -i 's/bootIdPubKeyPath:.*/bootIdPubKeyPath: \/root\/public.key/g' /root/config/module_configs.yaml

RUN ./hschain-cli genesis generate --input genesis_block_config.yaml --output genesis.block
RUN ./hschain-cli peer generate -o ./

CMD ["/root/hschain"]

